 var timer
Page({
  data: {
    num:3
  },
  onLoad() {
    this.reduceTimer()
  },
  reduceTimer(){
    timer=setTimeout(()=>{
      var num=this.data.num;
      num--;
      if(num>=0){
        this.setData({num});
        this.reduceTimer()
      }else{
        wx.switchTab({
          url: '/pages/home/home'
        });
      }
    },1000)
  },
  handleClick(){
    clearTimeout(timer)
    wx.switchTab({
      url: '/pages/home/home'
    });
  }
})
